package com.weigee.ktv.v.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.l.d.app.library.app.WrapFragment;
import com.l.d.app.library.eventbus.EventSend;

import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by 林德 on 2017/4/5 11:23.
 * <p/>
 */
@Deprecated
public abstract class BaseFragment extends WrapFragment {
    Unbinder unbinder;

    @Override
    public final void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EventSend.register(this);
    }

    @Nullable
    @Override
    public abstract View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState);

    @Override
    public final void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        unbinder = ButterKnife.bind(this, view);
        initView(view, savedInstanceState);
    }

    protected abstract void initView(View view, @Nullable Bundle savedInstanceState);

    @Override
    public void onDestroy() {
        super.onDestroy();
        unbinder.unbind();
        EventSend.unregister(this);
    }
}
